package cn.itcast.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.modelcontextprotocol.client.transport.HttpClientSseClientTransport;
import io.modelcontextprotocol.spec.McpClientTransport;
import org.springframework.ai.mcp.client.autoconfigure.NamedClientMcpTransport;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration
public class McpConfig {

    /**
     * 高德地图 MCP 服务
     */
//    @Bean
//    public List<NamedClientMcpTransport> amapMcpClientTransport() {
//        McpClientTransport transport = HttpClientSseClientTransport
//                .builder("https://mcp.amap.com")
//                .sseEndpoint("/sse?key=1111")
//                .objectMapper(new ObjectMapper())
//                .build();
//        return List.of(new NamedClientMcpTransport("amap", transport));
//    }


    /**
     * 高德地图 MCP 服务
     */
    @Bean
    public List<NamedClientMcpTransport> baiduMcpClientTransport() {
        McpClientTransport transport = HttpClientSseClientTransport
                .builder("https://mcp.amap.com")
                .sseEndpoint("/sse?key=1111")
                .objectMapper(new ObjectMapper())
                .build();
        return List.of(new NamedClientMcpTransport("baidumap", transport));
    }

}
